const express = require('express')
// 创建路由对象
const router = express.Router()
// 上传图片处理模块
const { upload } = require('../../utils/upload')

// 导入用户路由处理函数模块
const poemsListHandler = require('../../router_handler/poems-list')

// 上传诗单图片
router.post('/poemsList/uploadPoemsListCover', upload.single('file'), poemsListHandler.uploadPoemsListCover)

// 创建诗单
router.post('/poemsList/createPoemsList', upload.single('file'), poemsListHandler.createPoemsList)

// 获取诗单
router.post('/out/poemsList/getPoemsList', poemsListHandler.getPoemsList)

// 获取首页推荐的诗单
router.post('/out/poemsList/getRecommentPoemsList', poemsListHandler.getRecommentPoemsList)

// 用户首页获取全部诗单信息
router.post('/out/poemsList/getPoemsListByUser', poemsListHandler.getPoemsListByUser)

// 根据用户id获取诗单信息
router.get('/poemsList/getPoemsListByUid', poemsListHandler.getPoemsListByUid)

// 将诗歌加入诗单
router.post('/poemsList/addPoetryToPoemsList', poemsListHandler.addPoetryToPoemsList)

// 根据用户id和名称搜索诗单
router.post('/poemsList/searchPoemsListByNameAndUid', poemsListHandler.searchPoemsListByNameAndUid)

// 根据诗单名称搜索诗单
router.post('/out/poemsList/searchPoemsListByNameOrUid', poemsListHandler.searchPoemsListByNameOrUid)

// 根据id删除诗单信息
router.post('/poemsList/deletePoemsListById', poemsListHandler.deletePoemsListById)

// 根据id获取诗单详情
router.post('/out/poemsList/searchPoemsListDetailByPlId', poemsListHandler.searchPoemsListDetailByPlId)

// 用户创建诗单
router.post('/poemsList/userCreatePoemsList', poemsListHandler.userCreatePoemsList)

// 用户更新诗单
router.post('/poemsList/userUpdatePoemsList', poemsListHandler.userUpdatePoemsList)

// 收藏诗单
router.post('/poemsList/collectPoems', poemsListHandler.collectPoems)

// 查询收藏信息
router.post('/poemsList/queryCollectPoemsInfo', poemsListHandler.queryCollectPoemsInfo)

// 编辑诗单
router.post('/poemsList/editPoemsListInfo', upload.single('file'), poemsListHandler.editPoemsListInfo)

// 将路由对象共享出去
module.exports = router
